From: Michael Albinus Date: Tue, 12 Jan 2010 21:59:05 +0000 (+0100) Subject: * files.el (copy-directory): Compute target for recursive X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~8737 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=f25ff0ddddf5f2e89720d6770070ee53ce4773b5;p=emacs.git * files.el (copy-directory): Compute target for recursive directories with identical names. (Bug#5343) --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c670cb9eeaa..b9cd340f998 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-01-12 Michael Albinus + + * files.el (copy-directory): Compute target for recursive + directories with identical names. (Bug#5343) + 2010-01-12 Glenn Morris * mail/emacsbug.el (report-emacs-bug-pretest-address): Set diff --git a/lisp/files.el b/lisp/files.el index 22f5936a1f6..302f114befe 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4714,20 +4714,17 @@ this happens by default." ;; Compute target name. (setq directory (directory-file-name (expand-file-name directory)) newname (directory-file-name (expand-file-name newname))) - (if (and (file-directory-p newname) - (not (string-equal (file-name-nondirectory directory) - (file-name-nondirectory newname)))) - (setq newname - (expand-file-name (file-name-nondirectory directory) newname))) (if (not (file-directory-p newname)) (make-directory newname parents)) ;; Copy recursively. (mapc (lambda (file) - (if (file-directory-p file) - (copy-directory file newname keep-time parents) - (copy-file file newname t keep-time))) - ;; We do not want to delete "." and "..". + (let ((target (expand-file-name + (file-name-nondirectory file) newname))) + (if (file-directory-p file) + (copy-directory file target keep-time parents) + (copy-file file target t keep-time)))) + ;; We do not want to copy "." and "..". (directory-files directory 'full directory-files-no-dot-files-regexp)) ;; Set directory attributes.